/* Furgen operations dashboard — unified visual system */
:root {
  --canvas: #f3f5f9;
  --canvas-deep: #e9edf4;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-raised: #ffffff;
  --sidebar: #111827;
  --sidebar-hover: #1d2939;
  --sidebar-active: #30336b;
  --ink: #182230;
  --ink-soft: #344054;
  --muted: #667085;
  --muted-light: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --accent: #5b5bd6;
  --accent-hover: #4949bd;
  --accent-soft: #eeeeff;
  --accent-ring: rgba(91, 91, 214, 0.2);
  --success: #16825d;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --topbar-height: 72px;
  --nav-width: 232px;
}

html {
  color-scheme: light;
  background: var(--canvas);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 75% -15%, rgba(91, 91, 214, 0.07), transparent 34rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: var(--topbar-height);
  padding: 0 24px;
  color: #fff;
  background: rgba(17, 24, 39, 0.98);
  border: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.brand-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: #c8c8ff;
  background: linear-gradient(145deg, #6366df, #4545a4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 11px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.brand-mark svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.app-topbar h1 {
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-shadow: none;
}

.brand-subtitle {
  color: #98a2b3;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.auth-panel {
  min-width: 0;
  max-width: none;
  padding: 0;
  color: #d0d5dd;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.auth-panel h2 {
  display: none;
}

#login-form,
#user-info {
  align-items: center;
  gap: 12px;
}

#login-form {
  display: flex;
}

.auth-panel p,
#user-info p {
  margin: 0;
  color: #b9c0cc;
  font-size: 12px;
  line-height: 1.3;
}

#user-info strong {
  color: #fff;
}

.auth-error:empty {
  display: none;
}

.app-frame {
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
  min-height: 0;
}

.app-nav {
  position: sticky;
  top: var(--topbar-height);
  z-index: 20;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height));
  padding: 20px 12px 14px;
  overflow-y: auto;
  color: #d0d5dd;
  background: var(--sidebar);
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-label {
  margin: 0 10px 10px;
  color: #667085;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.workspace-nav-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  margin: 0 0 5px;
  padding: 9px 11px;
  color: #aeb7c5;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.workspace-nav-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace-nav-btn:first-of-type svg {
  fill: currentColor;
  stroke: none;
}

.workspace-nav-btn:hover {
  color: #fff;
  background: var(--sidebar-hover);
  border-color: rgba(255, 255, 255, 0.04);
  transform: none;
}

.workspace-nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(91, 91, 214, 0.72), rgba(67, 56, 202, 0.58));
  border-color: rgba(199, 200, 255, 0.16);
  box-shadow: inset 3px 0 0 #a5a6ff, 0 4px 12px rgba(0, 0, 0, 0.12);
}

.workspace-nav-btn:disabled {
  color: #596273;
  background: transparent;
  border-color: transparent;
  cursor: not-allowed;
  opacity: 0.72;
}

.workspace-nav-btn:disabled::after {
  content: "Locked";
  margin-left: auto;
  color: #697386;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 14px 10px 2px;
  color: #7f8999;
  font-size: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #32d583;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(50, 213, 131, 0.12);
}

.workspace {
  min-width: 0;
  padding: 28px 30px 44px;
}

.workspace-section {
  display: none;
  min-width: 0;
}

.workspace-section:not(.active) {
  display: none !important;
}

.workspace-section.active {
  display: grid;
  gap: 20px;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
}

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
}

.workspace-title h2 {
  margin: 2px 0 0;
  padding: 0;
  color: var(--ink);
  border: 0;
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 730;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.workspace-title p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.workspace-eyebrow,
.panel-kicker {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.workspace-context {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-xs);
  font-size: 11px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 750;
}

.live-indicator > span {
  width: 7px;
  height: 7px;
  background: #32d583;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(50, 213, 131, 0.13);
}

body:not(.dashboard-authorized) .live-indicator {
  color: var(--muted);
}

body:not(.dashboard-authorized) .live-indicator > span {
  background: var(--muted-light);
  box-shadow: 0 0 0 3px rgba(152, 162, 179, 0.13);
}

.context-copy {
  padding-left: 9px;
  border-left: 1px solid var(--border);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }

.card,
.panel {
  min-width: 0;
  padding: 20px;
  overflow: visible;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: none;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

.panel-title {
  min-width: 0;
}

.panel-title h2,
.panel > h2,
h2 {
  margin: 2px 0 0;
  padding: 0;
  color: var(--ink);
  border: 0;
  font-size: 16px;
  font-weight: 720;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.panel-title p,
.panel-description {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

h3 {
  margin: 0 0 10px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

h4 {
  color: var(--ink-soft);
  font-size: 12px;
}

.panel-subsection {
  padding: 16px 0 0;
  margin-top: 16px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  box-shadow: none;
}

label {
  display: block;
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  margin: 0 0 8px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
  font-size: 13px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-light);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aeb5c0;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 0;
  padding: 8px 13px;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xs);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 6px rgba(73, 73, 189, 0.2);
  transform: translateY(-1px);
}

button.secondary {
  color: var(--ink-soft);
  background: var(--surface);
  border-color: var(--border-strong);
}

button.secondary:hover {
  color: var(--ink);
  background: var(--surface-subtle);
  border-color: #aeb5c0;
}

button:disabled {
  color: var(--muted-light);
  background: #f2f4f7;
  border-color: var(--border);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

#loginBtn {
  min-height: 34px;
  color: #fff;
  background: #3538a8;
  border-color: #4e51c6;
}

#logoutBtn,
#refresh-active-workspace-btn {
  color: #e4e7ec;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
}

#bulkDeleteBtn,
.delete-single-btn,
.action-btn.warning {
  color: #fff !important;
  background: var(--danger) !important;
  border-color: var(--danger) !important;
}

#bulkDeleteBtn:disabled {
  color: var(--muted-light) !important;
  background: #f2f4f7 !important;
  border-color: var(--border) !important;
}

.mining-profit-status {
  min-height: 0;
  margin: -4px 0 10px;
}

.toolbar-row,
.registry-actions,
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin: 0;
}

.toolbar-row label,
.form-row label {
  margin: 0;
}

/* Operations hierarchy */
#workspace-operations.active {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

#workspace-operations > .workspace-header,
#workspace-operations > #health-container,
#workspace-operations > #servers-container,
#workspace-operations > .content-grid {
  grid-column: 1 / -1;
}

#workspace-operations > .workspace-header { grid-row: 1; }
#workspace-operations > #health-container { grid-row: 2; }
#workspace-operations > .content-grid { grid-row: 3; }
#workspace-operations > #servers-container { grid-row: 4; }

#health-container {
  background:
    linear-gradient(135deg, rgba(238, 238, 255, 0.48), rgba(255, 255, 255, 0) 38%),
    var(--surface);
}

.health-controls {
  display: grid;
  grid-template-columns: minmax(156px, 210px) minmax(115px, 145px) auto;
  gap: 9px;
  align-items: end;
}

.health-controls input,
.health-controls select {
  margin-bottom: 0;
}

.health-grid,
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.health-tile,
.metric-card {
  position: relative;
  min-width: 0;
  min-height: 88px;
  padding: 14px;
  overflow: hidden;
  color: var(--ink);
  text-align: left;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.health-tile::after,
.metric-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 38px;
  height: 38px;
  background: radial-gradient(circle at 100% 0, rgba(91, 91, 214, 0.1), transparent 68%);
}

.health-tile {
  border-left-width: 1px;
}

.health-tile:first-child.healthy {
  background: linear-gradient(145deg, #f0fdf6, #f8fffb);
  border-color: #b7ebd2;
}

.health-tile:first-child:not(.healthy):not(.warning):not(.critical) {
  background: #f8fafc;
  border-color: var(--border);
}

.health-tile h3,
.metric-card h3 {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.health-tile-value,
.metric-value {
  color: var(--ink);
  font-size: 20px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.health-tile-detail {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.health-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(500px, 1.65fr);
  gap: 14px;
  align-items: stretch;
}

.health-layout > section,
.health-layout > div {
  min-width: 0;
  padding: 15px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.health-issues {
  display: grid;
  gap: 8px;
}

.health-issue {
  padding: 10px 11px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
}

.health-issue.healthy { border-left-color: var(--success); }
.health-issue.warning { border-left-color: var(--warning); }
.health-issue.critical { border-left-color: var(--danger); }

.health-issue-title {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.health-issue-body,
.health-issue-action {
  color: var(--muted);
  font-size: 11px;
}

.health-status-text.healthy,
#status.completed,
.job-status.completed { color: var(--success); }
.health-status-text.warning { color: var(--warning); }
.health-status-text.critical,
#status.failed,
.job-status.failed,
#status.terminated,
.job-status.terminated { color: var(--danger); }

.health-pill,
.health-badge,
.job-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  color: var(--ink-soft);
  background: #f2f4f7;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.35;
}

.health-pill.healthy,
.health-badge.healthy { color: var(--success); background: var(--success-soft); border-color: #abefc6; }
.health-pill.warning,
.health-badge.warning { color: var(--warning); background: var(--warning-soft); border-color: #fedf89; }
.health-pill.critical,
.health-badge.critical { color: var(--danger); background: var(--danger-soft); border-color: #fecdca; }

/* Fleet and tabs */
#servers-container {
  padding: 20px;
}

.server-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  margin: 0 0 18px;
  padding: 4px;
  overflow-x: auto;
  background: #f2f4f7;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.server-tab-btn {
  min-height: 32px;
  padding: 6px 12px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  border-radius: 7px;
  box-shadow: none;
  white-space: nowrap;
}

.server-tab-btn:hover {
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.65);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.server-tab-btn.active {
  color: var(--ink);
  background: #fff;
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.server-tab-panel { display: none; }
.server-tab-panel.active { display: block; }

.servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 12px;
}

.server-instance,
.server-config-item {
  padding: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.server-instance:hover {
  background: #fff;
  border-color: #c7c9f4;
  box-shadow: var(--shadow-sm);
}

body.mining-focus .app-frame {
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
}

body.mining-focus .app-nav {
  display: flex;
}

body.mining-focus .workspace {
  padding: 28px 30px 44px;
}

body.mining-focus .workspace-header {
  display: flex;
}

/* Queue and operational tables */
#workspace-operations > .content-grid > .panel:first-child {
  min-height: 260px;
}

#workspace-operations > .content-grid > .panel:first-child .panel-header {
  display: grid;
  grid-template-columns: minmax(170px, 0.55fr) minmax(410px, 1.45fr);
}

#workspace-operations > .content-grid > .panel:first-child .toolbar-row {
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) auto auto;
  align-items: end;
}

#workspace-operations > .content-grid > .panel:first-child .toolbar-row select {
  margin: 0;
}

#untracked-vast-container {
  border-top: 3px solid var(--warning);
}

.table-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  scrollbar-color: #c7ccd4 transparent;
  scrollbar-width: thin;
}

.table-shell:has(> table[style*="display: none"]),
.table-shell:has(> table[style*="display:none"]) {
  min-height: 0;
  background: transparent;
  border-color: transparent;
}

.table-shell table {
  width: 100%;
  min-width: 760px;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

#health-latency-table,
#queue-by-type-table,
#queue-by-comfy-table {
  min-width: 520px;
}

th,
td {
  padding: 10px 11px;
  color: var(--ink-soft);
  text-align: left;
  vertical-align: middle;
  border: 0;
  border-bottom: 1px solid #edf0f3;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f8fafc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover td {
  background: #fafaff;
}

.job-row.selected td {
  background: var(--accent-soft);
}

code,
.job-id {
  color: #4b4da8;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.94em;
}

/* Jobs is a search command followed by a full-width activity surface. */
#workspace-jobs .content-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#workspace-jobs .content-grid > .panel {
  grid-column: 1;
}

.job-lookup-panel {
  display: grid;
  grid-template-columns: minmax(160px, 0.35fr) minmax(320px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 18px 20px;
  background:
    linear-gradient(90deg, rgba(238, 238, 255, 0.66), rgba(255, 255, 255, 0) 42%),
    #fff;
}

.job-lookup-heading {
  align-self: center;
}

.job-lookup-heading h2 {
  margin-top: 3px;
}

.job-lookup-panel > label {
  display: none;
}

.job-lookup-panel > input {
  min-height: 42px;
  margin: 0;
}

.job-lookup-panel > button {
  min-height: 42px;
  padding-inline: 18px;
}

.job-lookup-panel #results,
.job-lookup-panel #api-error,
.job-lookup-panel #loading-indicator {
  grid-column: 1 / -1;
}

.job-lookup-panel #results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 18px;
  padding: 14px;
  margin-top: 2px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.job-lookup-panel #results h3 {
  grid-column: 1 / -1;
}

.job-lookup-panel #results p {
  margin: 0;
}

#workspace-jobs .content-grid > .panel:last-child {
  min-height: 310px;
}

#workspace-jobs .table-shell {
  max-height: calc(100vh - 340px);
  min-height: 210px;
}

body:not(.dashboard-authorized) #workspace-jobs .table-shell:has(table[style*="display: none"]),
body:not(.dashboard-authorized) #workspace-jobs .table-shell:has(table[style*="display:none"]) {
  display: grid;
  place-items: center;
  min-height: 210px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(135deg, #f7f8fa 0 8px, #fbfcfd 8px 16px) border-box;
  border: 1px dashed var(--border-strong);
}

body:not(.dashboard-authorized) #workspace-jobs .table-shell:has(table[style*="display: none"])::after,
body:not(.dashboard-authorized) #workspace-jobs .table-shell:has(table[style*="display:none"])::after {
  content: "Recent jobs will appear here after you sign in.";
  max-width: 280px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

#refreshRegistryBtn,
#refresh-dependency-btn,
#refreshDecisionsBtn {
  color: var(--ink-soft);
  background: var(--surface);
  border-color: var(--border-strong);
}

/* Configuration and editors */
.config-workspace {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.config-workspace > .workspace-header,
.config-workspace > #dependency-manager-container {
  grid-column: 1 / -1;
}

.config-workspace > #admin-container {
  grid-column: span 4;
}

.config-workspace > #registry-container {
  grid-column: span 8;
}

.registry-editor-text {
  min-height: 280px;
  padding: 12px;
  color: #d0d5dd;
  background: #101828;
  border-color: #344054;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  line-height: 1.55;
}

.editor-shell {
  padding: 16px;
  margin-top: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.editor-actions,
.editor-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.editor-actions { margin-top: 10px; }

/* Feedback states */
.loading,
.api-error,
.auth-error {
  margin-top: 8px;
  font-size: 11px;
}

.loading {
  color: var(--muted);
  font-style: normal;
}

.api-error,
.auth-error,
#error-message {
  color: var(--danger);
}

.api-error:not(:empty),
.auth-error:not(:empty) {
  padding: 9px 11px;
  background: var(--danger-soft);
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
}

/* Medium layouts */
@media (max-width: 1280px) {
  :root { --nav-width: 208px; }

  .workspace { padding: 24px 22px 40px; }

  .health-layout { grid-template-columns: 1fr; }

  .config-workspace > #admin-container,
  .config-workspace > #registry-container {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1040px) {
  #workspace-operations > .content-grid {
    grid-template-columns: 1fr;
  }

  #workspace-operations > .content-grid > .panel {
    grid-column: 1;
  }

  .job-lookup-panel {
    grid-template-columns: minmax(160px, 0.4fr) minmax(260px, 1fr) auto;
  }

  .context-copy { display: none; }
  .live-indicator { padding-right: 1px; }
}

@media (max-width: 860px) {
  :root { --topbar-height: auto; }

  .app-shell {
    display: block;
  }

  .app-topbar {
    position: static;
    min-height: 66px;
    height: auto;
    padding: 11px 14px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
  }

  .auth-panel p { display: none; }

  .app-frame {
    display: block;
  }

  .app-nav,
  body.mining-focus .app-nav {
    position: sticky;
    top: 0;
    z-index: 24;
    display: flex;
    flex-direction: row;
    gap: 5px;
    width: 100%;
    height: auto;
    padding: 7px 10px;
    overflow-x: auto;
    background: rgba(17, 24, 39, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-label,
  .nav-footer {
    display: none;
  }

  .workspace-nav-btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    margin: 0;
    padding: 8px 11px;
    white-space: nowrap;
  }

  .workspace-nav-btn svg {
    width: 16px;
    height: 16px;
  }

  .workspace-nav-btn:disabled::after { display: none; }

  .workspace,
  body.mining-focus .workspace {
    padding: 20px 14px 34px;
  }

  .workspace-section.active {
    gap: 16px;
  }

  .workspace-header,
  body.mining-focus .workspace-header {
    display: flex;
    align-items: center;
  }

  .workspace-title h2 {
    font-size: 23px;
  }

  .workspace-context { display: none; }

  .panel,
  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .panel-header {
    gap: 12px;
  }

  #workspace-operations > .content-grid > .panel:first-child .panel-header {
    grid-template-columns: 1fr;
  }

  #workspace-operations > .content-grid > .panel:first-child .toolbar-row {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .health-controls {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .health-controls button {
    grid-column: 1 / -1;
  }

  .health-grid,
  .metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-tile,
  .metric-card {
    min-height: 84px;
  }

  .health-tile:first-child {
    grid-column: 1 / -1;
  }

  .job-lookup-panel {
    grid-template-columns: 1fr auto;
  }

  .job-lookup-heading {
    grid-column: 1 / -1;
  }

  #workspace-jobs .table-shell {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .app-topbar {
    min-height: 60px;
  }

  .brand-copy .brand-subtitle { display: none; }

  .topbar-actions { gap: 6px; }

  #loginBtn,
  #logoutBtn,
  #refresh-active-workspace-btn {
    min-height: 38px;
    padding-inline: 10px;
  }

  .workspace-nav-btn span {
    font-size: 11px;
  }

  .workspace-nav-btn {
    min-height: 40px;
  }

  .workspace {
    padding-inline: 10px;
  }

  .workspace-header {
    align-items: flex-start;
  }

  .workspace-title p {
    max-width: 34ch;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  #workspace-operations > .content-grid > .panel:first-child .toolbar-row {
    grid-template-columns: 1fr;
  }

  .panel-header > button {
    align-self: flex-start;
  }

  .health-controls {
    grid-template-columns: 1fr;
  }

  .health-controls button {
    grid-column: 1;
  }

  .health-layout > section,
  .health-layout > div {
    padding: 12px;
  }

  .job-lookup-panel {
    grid-template-columns: 1fr;
  }

  .job-lookup-heading,
  .job-lookup-panel > input,
  .job-lookup-panel > button {
    grid-column: 1;
  }

  .job-lookup-panel > button {
    min-height: 44px;
  }

  .server-tabs {
    width: 100%;
  }

  .table-shell table {
    min-width: 680px;
  }

  .toolbar-row,
  .registry-actions {
    align-items: stretch;
  }

  .toolbar-row > *,
  .registry-actions > * {
    max-width: 100%;
  }

  button {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
